#include<stdio.h>
#include<stdlib.h>
#include "dominion.h"


void testgetWinners(){

	struct gameState* gs;

	gs=newGame();

	int player1=0;
	int player2=1;
	int player3=2;

	int players[3];
	players[player1]=0;
	players[player2]=0;
	players[player3]=0;

	gs->numPlayers=3;

	for(int i=0;i<3;i++){
		gs->handCount[i]=6;
		gs->discardCount[i]=6;
		gs->deckCount[i]=6;
	}

	/*********Player 1 Total 34***************/
	gs->hand[player1][0] = curse;
	gs->hand[player1][1] = estate;
	gs->hand[player1][2] = duchy;
	gs->hand[player1][3] = province;
	gs->hand[player1][4] = great_hall;
	gs->hand[player1][5] = gardens; //total 10

	gs->discard[player1][0] = estate;
	gs->discard[player1][1] = estate;
	gs->discard[player1][2] = estate;
	gs->discard[player1][3] = estate;
	gs->discard[player1][4] = estate;
	gs->discard[player1][5] = estate; //total 6

	gs->deck[player1][0] = duchy;
	gs->deck[player1][1] = duchy;
	gs->deck[player1][2] = duchy;
	gs->deck[player1][3] = duchy;
	gs->deck[player1][4] = duchy;
	gs->deck[player1][5] = duchy; //total 18
	//Total 30



	/******Player 2 Total 64 - WINNER***********/
	gs->hand[player2][0] = curse;
	gs->hand[player2][1] = estate;
	gs->hand[player2][2] = duchy;
	gs->hand[player2][3] = province;
	gs->hand[player2][4] = great_hall;
	gs->hand[player2][5] = gardens; //total 10

	gs->discard[player2][0] = province;
	gs->discard[player2][1] = province;
	gs->discard[player2][2] = province;
	gs->discard[player2][3] = province;
	gs->discard[player2][4] = province;
	gs->discard[player2][5] = province; //total 36

	gs->deck[player2][0] = duchy;
	gs->deck[player2][1] = duchy;
	gs->deck[player2][2] = duchy;
	gs->deck[player2][3] = duchy;
	gs->deck[player2][4] = duchy;
	gs->deck[player2][5] = duchy; //total 15


	/******Player 3 Total 64**********/
	gs->hand[player3][0] = curse;
	gs->hand[player3][1] = estate;
	gs->hand[player3][2] = duchy;
	gs->hand[player3][3] = province;
	gs->hand[player3][4] = great_hall;
	gs->hand[player3][5] = gardens; //total 10

	gs->discard[player3][0] = duchy;
	gs->discard[player3][1] = duchy;
	gs->discard[player3][2] = duchy;
	gs->discard[player3][3] = duchy;
	gs->discard[player3][4] = duchy;
	gs->discard[player3][5] = duchy; //total 15

	gs->deck[player3][0] = province;
	gs->deck[player3][1] = province;
	gs->deck[player3][2] = province;
	gs->deck[player3][3] = province;
	gs->deck[player3][4] = province;
	gs->deck[player3][5] = province; //total 36


	gs->whoseTurn=2; //tiebreaker

	/**************************** TEST 1  ********************************/
	getWinners(players,gs);
	if(players[player2] && !players[player1] && !players[player3]){
			printf("getWinners(): PASS when player 2 wins.\n");
	}
	else{
			printf("getWinners(): FAIL when player 2 wins.\n");
	}

}


int main(int argc, char *argv[])
{

	testgetWinners();
    return 0;
}



